class Solution(object):
    def addStrings(self, num1, num2):
        """
        :type num1: str
        :type num2: str
        :rtype: str
        """
        if len(num1) < len(num2):
            (num1, num2) = (num2, num1)

        l1 = len(num1)
        num1 = [n for n in num1]
        num2 = num2.zfill(l1)
            
        carry = 0
        for i in list(range(l1))[::-1]:
            s = int(num1[i]) + int(num2[i]) + carry
            carry = s // 10
            num1[i] = str(s % 10)

        if carry == 1:
            num1.insert(0, '1')

        return ''.join(num1)
        
s = Solution()
print(s.addStrings("9", "99"))
print(s.addStrings("0", "0"))
print(s.addStrings("0", "10"))


